package com.usefullc.common.enums;


import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 抽样类型
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum SampleTypeEnum {


    NUMERAL(0, "数字"),

    RATIO(1, "比例"),




    ;


    private int code;
    private String value;

    SampleTypeEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public static SampleTypeEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (SampleTypeEnum s : SampleTypeEnum.values()) {
            if (s.getCode() == code) {
                return s;
            }
        }
        return null;
    }
    public static String getValueByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (SampleTypeEnum s : SampleTypeEnum.values()) {
            if (s.getCode() == code) {
                return s.getValue();
            }
        }
        return null;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getValue() {
        //国际化，重写desc TODO

        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

}
